import { defineStore } from 'pinia'
import {ref} from "vue";
import {selectInfo, selsPrivileges} from "../request/request";
/**
 * @param{{用户权限}}
 */
export const useUserStore = defineStore({
    id: 'my_user',
    state: () => {
        return {
            user:'',//
        }
    },
    actions:{
        updataUser(){
            selectInfo().then((res)=>{if (res.code==200){ this.user=res.data;}})
        }
    },
    // 开启数据缓存
    persist: {
        enabled: true,
        strategies: [
            {
                key: 'my_user',
                storage: localStorage,
                paths: ['user']
            }

        ]
    }
})


